package com.hd.crdao.activity;

import android.annotation.SuppressLint;
import android.view.View;
import android.webkit.WebView;

import com.hd.crdao.R;
import com.hd.crdao.base.BaseSecondActivity;
import com.hd.crdao.config.Constants;
import com.hd.crdao.view.ExpandHeadView;

import butterknife.BindView;

/**
 *
 *@author Programming
 *@date 2017/6/2 0002
 */
public class LoadUrlAboutUsActivity extends BaseSecondActivity {
    @BindView(R.id.loadurl)
    ExpandHeadView mLoadurl;
    @BindView(R.id.webview)
    WebView mWebView;

    @SuppressLint("SetJavaScriptEnabled")
    @Override
    protected void initView() {
        String url = getIntent().getStringExtra("url");
        switch (url) {
            case Constants.ABOUTUS_URL:
                mLoadurl.getHeadViewMidText().setText("关于我们");
                mWebView.loadUrl(url);
                break;
            case "serviceAgreement":
                mLoadurl.getHeadViewMidText().setText("服务协议");
                mWebView.loadUrl("file:///android_asset/html/car_agreement.html");
                break;
            default:
                mLoadurl.getHeadViewMidText().setText("帮助");
                mWebView.loadUrl(Constants.HELP_URL);
                break;
        }
        mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
        mWebView.getSettings().setBuiltInZoomControls(true);
        mWebView.getSettings().setJavaScriptEnabled(true);
    }

    @Override
    protected int setContentView() {
        return R.layout.activity_loadurl;
    }

    @Override
    protected ExpandHeadView setExpandHeadView() {
        return mLoadurl;
    }

}
